package com.zzti.controller;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.zzti.serviceImpl.OrderEquServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.*;

@Controller
public class demo {

    @GetMapping("/index")
    public String index() {
        return "redirect:index.html";
    }

    @GetMapping("/aaa")
    public String index2() {
        return "redirect:view/user/user-edit.html";
    }


    @GetMapping("/")
    public String login() {
        return "redirect:login.html";
    }


//    @RequestMapping("/index1")
//    public String index1() {
//        return "redirect:website.html";
//    }

    @GetMapping("/test2")
    @ResponseBody
    public String aaaas() {
        List ls1 = new ArrayList();
        List ls2 = new LinkedList();

        List all = new ArrayList();
        for (int i = 0; i < 5; i++) {
            ls1.add(i, i + 1);
        }
        for (int i = 0; i < 11; i++) {
            ls2.add(i, Math.random() * 1000 - 1);
        }
        all.add(ls1);
        all.add(ls2);
        String result2 = JSON.toJSONString(all);
        System.out.println(result2);
        return result2;
    }

    @Autowired
    private OrderEquServiceImpl orderEquService;

    @RequestMapping("/tusan")
    @ResponseBody
    public String aaa() {
        List<Map<String, Integer>> oemap = orderEquService.contOneMonthEqu();
        String s = JSON.toJSONString(oemap);
        System.out.println(s);
        return s;


    }
}
